/*
# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

# Notice:
# If you wish to use this code for commercial purposes, you must contact the author and obtain explicit authorization.
# The author is not responsible for any direct or indirect losses caused by the use of this code.
# If any of the above terms are violated, the author reserves the right to pursue legal action.
# Disclaimer:
# Please respect intellectual property rights and comply with relevant laws and regulations.

 */
#if DOTWEEN
using DG.Tweening;
#endif
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using UnityEngine;
using UnityEngine.UI;

public class UIPop : MonoBehaviour
{
	private sealed class _OpenPopup_c__AnonStorey2
	{
		internal int num;

		internal UIPop _this;

		internal void __m__0()
		{
			this._this.CompleteOpenPopup(this.num);
		}
	}

	private sealed class _ClosePopup_c__AnonStorey3
	{
		internal int num;

		internal UIPop _this;

		internal void __m__0()
		{
			this._this.CompleteClosePopup(this.num);
		}
	}

	private sealed class _ContinueCounterActive_c__Iterator0 : IEnumerator, IDisposable, IEnumerator<object>
	{
		internal UIPop _this;

		internal object _current;

		internal bool _disposing;

		internal int _PC;

		object IEnumerator<object>.Current
		{
			get
			{
				return this._current;
			}
		}

		object IEnumerator.Current
		{
			get
			{
				return this._current;
			}
		}

		public _ContinueCounterActive_c__Iterator0()
		{
		}

		public bool MoveNext()
		{
			uint num = (uint)this._PC;
			this._PC = -1;
			switch (num)
			{
			case 0u:
                     #if DOTWEEN
				this._this.ContinueNumbers[0].DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack).OnComplete(delegate
				{
					this._this.CompleteNumber(this._this.ContinueNumbers[0]);
				});
#endif
				this._current = new WaitForSeconds(1f);
				if (!this._disposing)
				{
					this._PC = 1;
				}
				return true;
			case 1u:
                     #if DOTWEEN
				this._this.ContinueNumbers[1].DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack).OnComplete(delegate
				{
					this._this.CompleteNumber(this._this.ContinueNumbers[1]);
				});
#endif
				this._current = new WaitForSeconds(1f);
				if (!this._disposing)
				{
					this._PC = 2;
				}
				return true;
			case 2u:
                     #if DOTWEEN
				this._this.ContinueNumbers[2].DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack).OnComplete(delegate
				{
					this._this.CompleteNumber(this._this.ContinueNumbers[2]);
				});
#endif
				this._current = new WaitForSeconds(1f);
				if (!this._disposing)
				{
					this._PC = 3;
				}
				return true;
			case 3u:
                     #if DOTWEEN
				this._this.ContinueNumbers[3].DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack).OnComplete(delegate
				{
					this._this.CompleteNumber(this._this.ContinueNumbers[3]);
				});
#endif
				this._current = new WaitForSeconds(1f);
				if (!this._disposing)
				{
					this._PC = 4;
				}
				return true;
			case 4u:
                     #if DOTWEEN
				this._this.ContinueNumbers[4].DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack).OnComplete(delegate
				{
					this._this.CompleteNumber(this._this.ContinueNumbers[4]);
				});
#endif
				this._current = new WaitForSeconds(1f);
				if (!this._disposing)
				{
					this._PC = 5;
				}
				return true;
			case 5u:
                     #if DOTWEEN
				this._this.ContinueNumbers[5].DOScale(Vector3.one, 0.5f).SetEase(Ease.OutBack).OnComplete(delegate
				{
					this._this.CompleteNumber(this._this.ContinueNumbers[5]);
				});
#endif
				this._current = new WaitForSeconds(1f);
				if (!this._disposing)
				{
					this._PC = 6;
				}
				return true;
			case 6u:
				this._this.screen_manager.NoContinuePop();
				this._PC = -1;
				break;
			}
			return false;
		}

		public void Dispose()
		{
			this._disposing = true;
			this._PC = -1;
		}

		public void Reset()
		{
			throw new NotSupportedException();
		}

		internal void __m__0()
		{
			this._this.CompleteNumber(this._this.ContinueNumbers[0]);
		}

		internal void __m__1()
		{
			this._this.CompleteNumber(this._this.ContinueNumbers[1]);
		}

		internal void __m__2()
		{
			this._this.CompleteNumber(this._this.ContinueNumbers[2]);
		}

		internal void __m__3()
		{
			this._this.CompleteNumber(this._this.ContinueNumbers[3]);
		}

		internal void __m__4()
		{
			this._this.CompleteNumber(this._this.ContinueNumbers[4]);
		}

		internal void __m__5()
		{
			this._this.CompleteNumber(this._this.ContinueNumbers[5]);
		}
	}

	private sealed class _EnableButton_c__Iterator1 : IEnumerator, IDisposable, IEnumerator<object>
	{
		internal Button obj;

		internal object _current;

		internal bool _disposing;

		internal int _PC;

		object IEnumerator<object>.Current
		{
			get
			{
				return this._current;
			}
		}

		object IEnumerator.Current
		{
			get
			{
				return this._current;
			}
		}

		public _EnableButton_c__Iterator1()
		{
		}

		public bool MoveNext()
		{
			uint num = (uint)this._PC;
			this._PC = -1;
			switch (num)
			{
			case 0u:
				this._current = new WaitForSeconds(0.5f);
				if (!this._disposing)
				{
					this._PC = 1;
				}
				return true;
			case 1u:
				this.obj.enabled = true;
				this._PC = -1;
				break;
			}
			return false;
		}

		public void Dispose()
		{
			this._disposing = true;
			this._PC = -1;
		}

		public void Reset()
		{
			throw new NotSupportedException();
		}
	}

	public ScreenManager screen_manager;

	public List<GameObject> PopupObjs;

	public List<Transform> ContinueNumbers;

	private float OpenSpeed = 0.3f;

	private float CloseSpeed = 0.25f;

	public void OpenPopup(int num)
	{
		SingletonComponent<SoundManager>.Instance.SystemSound(1);
		if (num == 4 || num == 5)
		{
			this.PopupObjs[num].transform.Find("Inbox").Find("SoundSlider").GetComponent<Slider>().value = Entity.IsSoundSave;
		}
		if (num == 2)
		{
			this.Tip_Text();
		}
		Image component = this.PopupObjs[num].transform.Find("BG").GetComponent<Image>();
		Transform target = this.PopupObjs[num].transform.Find("Inbox");
         #if DOTWEEN
		component.DOFade(0f, 0f);
		target.DOScale(Vector3.zero, 0f);
		this.PopupObjs[num].SetActive(true);
		component.DOFade(0.7f, this.OpenSpeed).SetEase(Ease.OutBack);
		target.DOScale(Vector3.one, this.OpenSpeed).SetEase(Ease.OutBack).OnComplete(delegate
		{
			this.CompleteOpenPopup(num);
		});
#endif
	}

	private void CompleteOpenPopup(int num)
	{
		if (num == 2)
		{
			this.ContinueCounter();
		}
	}

	public void ClosePopup(int num)
	{
		Image component = this.PopupObjs[num].transform.Find("BG").GetComponent<Image>();
		Transform target = this.PopupObjs[num].transform.Find("Inbox");
         #if DOTWEEN
		component.DOFade(0f, this.CloseSpeed).SetEase(Ease.InBack);
		target.DOScale(Vector3.zero, this.CloseSpeed).SetEase(Ease.InBack).OnComplete(delegate
		{
			this.CompleteClosePopup(num);
		});
#endif
	}

	private void CompleteClosePopup(int num)
	{
		this.PopupObjs[num].SetActive(false);
	}

	public void ContinueCounter()
	{
		base.StartCoroutine("ContinueCounterActive");
	}

	public void KillContinueCounter()
	{
		base.StopCoroutine("ContinueCounterActive");
	}

	private IEnumerator ContinueCounterActive()
	{
		UIPop._ContinueCounterActive_c__Iterator0 _ContinueCounterActive_c__Iterator = new UIPop._ContinueCounterActive_c__Iterator0();
		_ContinueCounterActive_c__Iterator._this = this;
		return _ContinueCounterActive_c__Iterator;
	}

	private void CompleteNumber(Transform target)
	{
         #if DOTWEEN
		target.DOScale(0f, 0.2f).SetDelay(0.3f);
#endif
	}

	public void OnClickSound(int index)
	{
		SingletonComponent<SoundManager>.Instance.SystemSound(index);
	}

	public void OnceClickProtector(Button obj)
	{
		obj.enabled = false;
		base.StartCoroutine(this.EnableButton(obj));
	}

	private IEnumerator EnableButton(Button obj)
	{
		UIPop._EnableButton_c__Iterator1 _EnableButton_c__Iterator = new UIPop._EnableButton_c__Iterator1();
		_EnableButton_c__Iterator.obj = obj;
		return _EnableButton_c__Iterator;
	}

	public void AppQuit()
	{
		Application.Quit();
	}

	private void Tip_Text()
	{
		List<string> list = new List<string>();
		list.Add("Continue the combo by using the blocks that will come up next");
		list.Add("Combo can get bigger points than you think!");
		list.Add("The TNT block is powerful enough to change the flow of the game!");
		list.Add("Be careful with the stone blocks. Game over in a flash!");
		list.Add("How many combo do you have?");
		list.Add("Stone blocks are disappear after a two delete.");
		list.Add("TNT blocks even destroy adjacent blocks when they explode!");
		list.Add("There are four types of wooden blocks.");
		list.Add("If you score, you can see two special blocks.");
		list.Add("If you're having fun, leave a review! Thank you so much.");
		list.Add("Thank you for playing.");
		list.Add("It's very helpful if you leave a review.");
		list.Add("If you're having trouble playing games, check the blanks at the bottom.");
		list.Add("Compare your ranking with your friends!");
		this.PopupObjs[2].transform.Find("Inbox").Find("TextTip").GetComponent<Text>().text = list[UnityEngine.Random.Range(0, list.Count)];
	}
}
